<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Carriers,com.ejoysoft.wlanyz.business.Comunity,com.ejoysoft.wlanyz.business.Task,com.ejoysoft.wlanyz.business.Ap,com.ejoysoft.wlanyz.business.Ac,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
	if(!globa.userSession.hasRight("50010"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<% try{
	//初始化
    Carriers  obj0=null;
    Carriers obj=new Carriers(globa);
    //查询条件
    String  strCity=ParamUtil.getString(request,"strCity","").trim();
    String  strNetType=ParamUtil.getString(request,"strNetType","").trim();
    String  strStartTime=ParamUtil.getString(request,"strStartTime","").trim();
    String  strEndTime=ParamUtil.getString(request,"strEndTime","").trim();
     if(strStartTime.compareTo(strEndTime)>0)
       {
          out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
        } 
    String checked1 =  ParamUtil.getString(request,"checkedFlag","all");
	String tWhere=" ";
	if (!strCity.equals("")) {
	  tWhere += " and wlan_resc_comunity.strCity LIKE '%" + strCity + "%'";
	}
	if (!strNetType.equals("")) {
	  tWhere += " and wlan_test_result.strNetType LIKE '%" + strNetType + "%'";
	}
	int intAllCount; 
	if(strCity.equals("")&&strNetType.equals("")&&strStartTime.equals("")&&strEndTime.equals(""))
	{ tWhere+=" where 1=1";
	  intAllCount=obj.getCount(tWhere);
	  }
	  else {
	  intAllCount=obj.getCount1(tWhere);
	  }
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
    int intPageSize;
    if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<Carriers> vctObj;
	if(strCity.equals("")&&strNetType.equals("")&&strStartTime.equals("")&&strEndTime.equals(""))
	{ 
	 vctObj=obj.list(tWhere,intStartNum,intPageSize);
	 }
	 else
	 { vctObj=obj.list2(tWhere,intStartNum,intPageSize,strStartTime,strEndTime);
	 }
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<script language="javascript">
function showPic() {
   frm.action="carriers_Pic.jsp";
   frm.submit();
}


 function showAc(){ 
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
 function export_sbm(page){ 
  frm.action="carriers_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";
  document.getElementById("exportContent").value = page;
  frm.submit();
 }

</script>
<style>
A {text-decoration: NONE} 
</style>
</head>


<body>
<form name=frm method=post action="carriers_list.jsp"> 
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value="<%=intCurPage%>"/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>
<input id="checkedFlag" name="checkedFlag" type="hidden" value="<%=checked1%>"/>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="bottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">运行商对比分析</font> &gt; 测试结果信息管理</td>
  </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="18%">地市：
          <select id="strCity" name="strCity" class="input_box" >
          <option value=''>- - - - -请选择- - - - -</option>
                    <%
                    Carriers objcity =new Carriers(globa);
                    Vector<Carriers> vctObjcity=objcity.listcity();
                    for (int i = 0;i < vctObjcity.size(); i++) {
                    Carriers obj3 = vctObjcity.get(i);
              %>
                <option value="<%=obj3.getStrcity()%>"><%=obj3.getStrcity()%></option>
              <%
                  }
              %>
                 </select>
          </td>
          <td width="21%">网络类型：
          <input type="text" name="strNetType" value="<%=strNetType %>"/></td>
          <td width="21%">开始时间：
           <input  name="strStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strStartTime %>"style="width:100"/></td>
          <td width="27%">结束时间：
           <input  name="strEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strEndTime %>"style="width:100"/>
          <img src="../images/search.jpg" width="58" height="28" align="middle" onclick="showAc()" style="cursor:hand"/></td>
          <td><input name="B1" type="button" value="对比图表"  onclick="showPic()"/></td>
         </tr>
      </table></td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>
     <td width="6%" class="listtit"  style="border-left:1px solid #32a4ea;"><input type="checkbox" name="checkbox62" value="checkbox" onclick="selAll(document.all.strId)" style="height:12px;" />
    全选</td>
    <td width="5%" class="listtit">地市</td>
    <td width="5%" class="listtit">区</td>
    <td width="12%" class="listtit">热点名称</td>
    <td width="15%" class="listtit">AP名称</td>
    <td width="8%" class="listtit">运营商</td>
    <td width="8%" class="listtit">任务名称</td>
    <td width="8%" class="listtit">MAC</td>
    <td width="20%" class="listtit">时限</td>
    <td class="listtit">操作</td>
  </tr>
    <%
   
   if(vctObj!=null){
    
    	for (int i = 0;i < vctObj.size(); i++) {
    	
                  String strId = "";//结果id
                  String strApMac = "";//APMac
                  String strCarriers="";//运行商
                  String strTaskId=""; //任务Id
                  String strTaskName="";//任务名称
                  String time="";//任务时限
                  String strApName="";//AP名称
                  String hotpotid="";//热点Id
                  String city="";//地市
                  String town="";//区
                  String hotpotname="";//热点名称
                  String community="";//小区
                  Carriers obj1 = vctObj.get(i);
                  strId= Format.forbidNull(obj1.getStrId());
                  strApMac= Format.forbidNull(obj1.getStrApMac());//Mac
                  strCarriers= Format.forbidNull(obj1.getStrCarriers());//运行商
                  strTaskId = Format.forbidNull(obj1.getStrTaskId());
                  community= Format.forbidNull(obj1.getStrCommunityId());//小区ID
                  Task obj2=new Task(globa);
                  String where2= "where strTaskId = '" + strTaskId + "'";
                  Task vctObj2=obj2.show1(where2);
                  if(vctObj2==null)
                  {
                   strTaskName=" ";
                   time=" ";
                  }
                  else {
                  strTaskName= Format.forbidNull(vctObj2.getStrTaskName());//任务名称
                  if(vctObj2.getDtStartTime()!=null||vctObj2.getDtEndTime()!=null)time=vctObj2.getDtStartTime()+"———"+vctObj2.getDtEndTime();//时限
                  }
                  Ap obj3=new Ap(globa);
                  String where3= "where strMac_Addr = '" + strApMac + "'";
                  Ap vctObj3=obj3.show1(where3);
                  if(vctObj3==null)
                  {strApName =" ";
                  hotpotname=" ";
                  }
                   else
                   { strApName=  Format.forbidNull(vctObj3.getDevice_Name());//Ap名称
                  hotpotid =  Format.forbidNull(vctObj3.getStrHotSpot());
                  Ac obj4=new Ac(globa);
                  String where4= "where strId = '" + hotpotid + "'";
                  Ac vctObj4=obj4.show(where4); 
                  hotpotname= Format.forbidNull(vctObj4.getStrHotPotName());//热点名称
                  }
                  Carriers obj5=new Carriers(globa);
                  String where5= " where strCommId = '"+community + "'";
                   Carriers vctObj5=obj5.show3(where5); 
                   city=  Format.forbidNull(vctObj5.getStrcity1());
                   town = Format.forbidNull(vctObj5.getStrtown1());
                  
                //  System.out.println("strApMac:"+strApMac+"000000000000000000strCarriers:"+strCarriers+"oooooooooooostrTaskName:"+strTaskName+"ooooooooooootime:"+time+ "oooooooooooooostrApName:"+strApName+"000000000000000000city:"+city+"oooooooooootown:"+town+"oooooooooohotpotname:"+hotpotname);
    %>             

  <tr>
   <td width="6%" class="listd1" style="border-left:1px solid #dddddd;"><input type="checkbox"  name=strId value="<%=strId %>" style="height:12px;" /></td>
    <td class="listd1" style="border-left:1px solid #dddddd;" width="5%" ><%=city%>&nbsp;</td>
    <td class="listd1" width="5%"><%=town%>&nbsp;</td>
    <td class="listd1" width="8%"><%=hotpotname%>&nbsp;</td>
    <td class="listd1" width="8%"><%=strApName%>&nbsp;</td>
    <td class="listd1" width="8%"><%=strCarriers%>&nbsp;</td>
    <td class="listd1" width="8%"><%=strTaskName%>&nbsp;</td>
    <td class="listd1" width="8%"><%=strApMac%>&nbsp;</td>
    <td class="listd1" width="20%"><%=time%>&nbsp;</td> 
    <td class="listd1" style="border-right:1px solid #dddddd;"><a href="carriers_index.jsp?strId=<%=strId%>">查看指标&nbsp;</a><a href="carriers_near.jsp?strId=<%=obj1.getStrNeiCommunityId()%>">查看相邻小区&nbsp;</a>
    </td>
  </tr>
             <%
            }
            }
            %>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images/pldel.jpg" width="83" height="27" align="middle" />--> &nbsp;&nbsp;页面记录数
      <select name="strPageSize" id="strPageSize" style="width:52px;" onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		 %>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>
   		 </select>
      <img src="../images/dc.jpg" width="92" height="27" align="middle" onclick="export_sbm('currentPage')" style="cursor:hand"/> 
      <img src="../images/dcall.jpg" width="82" height="27" align="middle" onclick="export_sbm('allPage')" style="cursor:hand"/></td>
      
      <td>  <input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
       		 <input id="strCurPage" name="strCurPage" type="hidden" value=""/>
			<input id="exportContent" name="exportContent" type="hidden" value=""/></td>
    
      <td width="39%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
       </tr>
    </table>
  -->
  <!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
</table>




</form>
</body>
</html>
<%}catch(Exception e){e.printStackTrace();} %>
<%@ include file="../include/jsp/footer.jsp"%>